#include <iostream>
#include <array>
#include <cassert>

using std::cout;
using std::endl;
//1. 递归计算 factorial   用assert进行检查
//2. 将factorial变为常亮的表达式    用static——assert进行检查
//3，创建f(4)大小的数组
constexpr int factorial(int n){
    if (n==0){
        return 1;
    } else{
        return n*factorial(n-1);
    }
}

int main() {
    std::cout << "Hello, World!" << std::endl;
//    int x =3;
//    auto f = factorial(x);
//    assert(f ==6);
//    cout << "3!=" << f << endl;
    static_assert(factorial(3)==6,"f(3) should be 6");

    std::array <int,factorial(3)>a;
    cout << a.size();

    std::cin.get();
    return 0;
}
